
<?php 
echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>  
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  <title>Spagooy - Spagooy: Play a game of online Yatzy</title>
  <?php echo $this->headLink()->appendStylesheet('/css/master.css') ?>
</head> 
<body>

	<div id="container">
		<?php
			
			echo $this->partial('login.phtml');
			
			
				$url = $_SERVER['REQUEST_URI'];
				$params = explode('/', $url);
				$languagesString = Zend_Registry::get('config')->languages;
				$languages = explode('/', $languagesString);
				$retUrl = "/";
				$lang = "";	
				if (in_array($params[1], $languages)){
					$lang = "/" . $params[1];	
					for ($i = 2; $i < count($params); ++$i){
						$retUrl .= $params[$i];
					}
				} else {
					for ($i = 1; $i < count($params); ++$i){
						$retUrl .= $params[$i];
					}
				}
			?>

		<div id="head">
			<div id="languageChoice">
				<ul>
					<?php
						$langs = Zend_Registry::get('config')->lang->toArray();
						
						//for($i=0; $i<count($langs); ++$i)
						{
							while($language = current($langs))
							{
								$langCode = key($langs);
								?>				
								<li>
									<?php 
										if (in_array($params[1], $languages))
										{
											if ($params[1] == $langCode){
												?><a href=""><img src="../pics/flags/<?php echo($langCode); ?>.png" alt="<?php echo($language); ?>"/></a><?php
											} else {
												?><a href="http://localhost/<?php echo($langCode); ?><?php echo($retUrl); ?>">	<img src="../pics/flags/<?php echo($langCode); ?>.png" alt="<?php echo($language); ?>"/></a><?php														
											}
										} else
										{							
											?><a href="<?php echo($langCode); ?><?php echo($url) ?>"><img src="pics/flags/<?php echo($langCode); ?>.png" alt="<?php echo($language); ?>"/></a><?php												
										}
									?>						
								</li>
								<?php
								
								next($langs);
							}
						}			
					?>
					
				</ul>
			</div>
			
			<div id="loginDiv">
				<ul>
					<li>
				    	<?php
						$l = "<a href='http://" . $_SERVER["SERVER_NAME"] . $lang . "/register'>" . Zend_Registry::get('translate')->_("SIGN_UP") . "</a>";
						echo($l);
						?>						
				    </li>
				    <li>
				    	<?php
						$l = "<a href='http://" . $_SERVER["SERVER_NAME"] . $lang . "/login'>" . Zend_Registry::get('translate')->_("LOGIN") . "</a>";
						echo($l);
						?>						
				    </li>
				</ul>	
				<div class="empty"></div>							
			</div>
			
			<div id="logo">
				<h1>Spagooy</h1>
			</div>
			
			
		
			<div id="mainMenu">
				<ul>
					<li>
					<?php
						$l = "<a href='http://" . $_SERVER["SERVER_NAME"] . $lang . $this->url(
				            array('controller'=>'index'), 
				            'default', 
				            true) . "'>" . Zend_Registry::get('translate')->_("HOME") . "</a>";
						echo($l);						
					?>
				    </li>
				    <li>
				    	<?php
						$l = "<a href='http://" . $_SERVER["SERVER_NAME"] . $lang . $this->url(
				            array('controller'=>'game'), 
				            'default', 
				            true) . "'>" . Zend_Registry::get('translate')->_("PLAY") . "</a>";
						echo($l);
						?>						
				    </li>
				    <li>
				    	<?php
						$l = "<a href='http://" . $_SERVER["SERVER_NAME"] . $lang . $this->url(
				            array('controller'=>'statistics'), 
				            'default', 
				            true) . "'>" . Zend_Registry::get('translate')->_("HIGHSCORE") . "</a>";
						echo($l);
						?>						
				    </li>

				    <li>
				    	<?php
						$l = "<a href='http://" . $_SERVER["SERVER_NAME"] . $lang . "/mypage'>" . Zend_Registry::get('translate')->_("MY_PAGE") . "</a>";
						echo($l);
						?>						
				    </li>
				</ul>
			</div>
			<div class="empty"></div>
		</div>
		
		<div id="content">
			<?php echo $this->layout()->content ?>
		</div>
		
		<div id="footer">
			Footer
		</div>
		
	</div>
</body>
</html>



































<!-- <?php 

echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>  
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  <title>Zend Framework Quickstart Application</title>
  <?php echo $this->headLink()->appendStylesheet('/css/global.css') ?>
</head> 
<body>
<div id="header" style="background-color: #EEEEEE; height: 30px;">
    <div id="header-logo" style="float: left">
        <b>ZF Quickstart Application</b>
    </div>
    <div id="header-navigation" style="float: right">
        <a href="<?php echo $this->url(
            array('controller'=>'guestbook'), 
            'default', 
            true) ?>">Guestbook</a>
    </div>
</div>

<?php echo $this->layout()->content ?>

</body>
</html>
-->